package com.tan.androidtest.java;

/**
 * 测试Integer和Long -128 ~ 127范围类的缓存
 */

public class TestIntegerAndLong {

    public static void main(String[] args) {

        Integer i1 = 100;
        Integer i2 = 100;

        System.out.println(i1 == i2);

        Integer i3 = 150;
        Integer i4 = 150;

        System.out.println(i3 == i4);

        //new Integer新建对象,其引用地址是不一样的,==比较的是引用的地址指向的堆中对象是不是一样的
        Integer i5 = new Integer(100);
        Integer i6 = new Integer(100);
        System.out.println(i5 == i6);

        String s1 = "111";
        String s2 = "111";
        System.out.println(s1 == s2);

        Long l1=new Long(100);
        Long l2=new Long(100);
        System.out.println(l1 == l2);
    }

}
